import {HTTP} from '../utils/http-p.js';

class BookModel extends HTTP{
    /**
     * 获取热门书籍(概要)
     */
    getHotList(){
        /*return this.request({
                url:"book/hot_list",
                data:{},
                method:"POST"
            });*/
        return this.request({url:"book/hot_list"});
    }
    /**
     * 获取书籍短评
     * @param {0} book_id 
     */
    getBookComment(book_id){
        return this.request({
            url:`book/${book_id}/short_comment`
        });
    }
    /**
     * 获取喜欢书籍数量
     */
    getBookFavorCount(){
        return this.request({
            url:"book/favor/count",
        });
    }

    /**
     * 获取书籍点赞情况
     * @param {0} book_id 
     */
    getBookFavorStatus(book_id){
        return this.request({
            url:`book/${book_id}/favor`
        });
    }
    /**
     * 获取书籍详细信息
     */
    getBookDetail(book_id){
        return this.request({
            url:`book/${book_id}/detail`,
        });
    }
    /**
     * 新增短评
     */
    postComment (book_id , comment){
      return this.request({
        url:"book/add/short_comment",
        data:{
          book_id:book_id,
          content:comment
        },
        method:"POST"
      });
    }
    /**
     * 书籍搜索
     */
    search(start , q){
        return this.request({
            url:"book/search",
            data:{
                start:start,
                summary:1,
                q:q
            }
        });
    }
    
    /**
     * 获取点赞书籍的数量
     */
    getMyBookCount(){
        return this.request({
            url:"book/favor/count",
        });
    }
}

export {BookModel}